<html>
<body>
<head>
    <title>	My Calendar </title>
    
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
</head>    
<?php
include_once("php/dbconfig.php");


$sql ="CREATE PROCEDURE  prcd_cleanInitialTableData()";
$sql .= "BEGIN ";

$sql .= "DELETE FROM `event_type`;
DELETE FROM `city`;
DELETE FROM `venue`;";

$sql .= " END";

$sqlCall = "call prcd_cleanInitialTableData();";

$sqlDropProcd = "drop procedure if exists prcd_cleanInitialTableData;";



try{
    
     $db = new DBConnection();
     $db->getConnection();
     
     if(mysql_query($sql) == false)
     {
//         echo '<br>Read table fail</br>';
//         echo mysql_error();
         
          echo '<br>Create procedure fail</br>';
        echo mysql_error();
     }
 else {
     echo '<br>Create procedure sucessfully</br>';
     }
     
     if(mysql_query($sqlCall) == false){
          echo '<b>Call procedure fail</b>';
         echo mysql_error();
     }  else {
         echo '<br>Call procedure sucessfully</br>';
     }
     
     if(mysql_query($sqlDropProcd) == false){
          echo '<br>Drop procedure fail</br>';
         echo mysql_error();
     }  else {
          echo '<br>Drop procedure sucessfully</br>';
     }
    
}catch(Exception $e)
{
    $e->getMessage();
}

?>
</body>
</html>
